package cn.jiedh.app.meiweidk.Utils.UI;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

/**
 * @name：
 * @author： 周毅
 * @phone： 15826080712
 * @createTime： 2017/6/16
 * @modifyTime： 2017/6/16
 * @explain：
 */

public class MyScrollviewForOpenScrollchange extends ScrollView {
    private ScrollViewListener scrollViewListener = null;

    public MyScrollviewForOpenScrollchange(Context context) {
        super(context);
    }

    public MyScrollviewForOpenScrollchange(Context context, AttributeSet attrs,
                                           int defStyle) {
        super(context, attrs, defStyle);
    }

    public MyScrollviewForOpenScrollchange(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setScrollViewListener(ScrollViewListener scrollViewListener) {
        this.scrollViewListener = scrollViewListener;
    }

    @Override
    protected void onScrollChanged(int x, int y, int oldx, int oldy) {
        super.onScrollChanged(x, y, oldx, oldy);
        if (scrollViewListener != null) {
            scrollViewListener.onScrollChanged(this, x, y, oldx, oldy);
        }
    }

    public interface ScrollViewListener {

        void onScrollChanged(MyScrollviewForOpenScrollchange scrollView, int x, int y,
                             int oldx, int oldy);

    }
}
